package com.good.domain.Utils;

import cn.hutool.crypto.digest.DigestAlgorithm;
import cn.hutool.crypto.digest.Digester;

import java.nio.charset.StandardCharsets;

/**
 * @author duyf
 */
public class DigesterUtil {
    /**
     * sha1盐
     */
    private static final String salt = "tstdke3hc";

    /**
     * 获取sha1摘要后字符串
     *
     * @param str
     * @return
     */
    public static String getSHA1(String str) {
        Digester sha = new Digester(DigestAlgorithm.SHA1);
        sha.setSalt(salt.getBytes(StandardCharsets.UTF_8));
        return sha.digestHex(str);
    }
}
